
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>pageContext</title>
</head>
<body>
    <%
        //pageContext:既可以放入自己的域中，也可以操作其他域 request session application
        pageContext.setAttribute("pageDate", "当前页");
        pageContext.setAttribute("requestDate", "request数据",PageContext.REQUEST_SCOPE);
        pageContext.setAttribute("sessionDate", "session数据", PageContext.SESSION_SCOPE);
        pageContext.setAttribute("applicationDate", "application数据", PageContext.APPLICATION_SCOPE);
    %>

    <%
        //从四个域中获取数据
        String pageDate= (String) pageContext.getAttribute("pageDate");
        String requestDate= (String) pageContext.getAttribute("requestDate", PageContext.REQUEST_SCOPE);
        String sessionDate= (String) pageContext.getAttribute("sessionDate", PageContext.SESSION_SCOPE);
        String applicationDate= (String) pageContext.getAttribute("applicationDate", PageContext.APPLICATION_SCOPE);

        //findAttribute从四个域中查找，pageContext request  session  application
        pageContext.findAttribute("pageDate");
        //removeAttribute();从四个域中都移除
        pageContext.removeAttribute("pageDate");
    %>

    <%=pageDate%><br/>
    <%=requestDate%><br/>
    <%=sessionDate%><br/>
    <%=applicationDate%><br/>


</body>
</html>
